import { request } from "@yaf/request";
import { toApi } from "@/service/proxyApi";
import { RequestDataType, RespDataType } from "./apiType";

export * from "./apiType";

const { get, postJSON, del, put } = request;

/**
 * 创建组织
 */
export const createDept = (params: RequestDataType.addDeptItem) => {
  return postJSON(toApi("api/v1/system/dept/add"), params);
}

/**
 * 删除组织
 */
export const delDept = (deptId: number) => {
  return del(toApi("api/v1/system/dept/delete?id=" + deptId));
}

/**
 * 获取组织列表数据
 */
export const getDeptList = (params: RequestDataType.queryDeptItem) => {
  return get<RespDataType.DeptListInfo>(toApi("api/v1/system/dept/list"), params);
}

/**
 * 更新组织信息
 */
export const updateDept = (params: Partial<RequestDataType.UpdateDeptItem>) => {
  return put(toApi("api/v1/system/dept/edit"), params);
}



